package com.ruoyi.disasterassessment.service.impl;

import java.util.List;
import java.util.stream.Collectors;

import com.ruoyi.disasterassessment.dto.MiningFaceDto;
import com.ruoyi.disasterassessment.mapper.DisasterEvaluatingReportMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.disasterassessment.mapper.MiningFaceModelMapper;
import com.ruoyi.disasterassessment.domain.MiningFaceModel;
import com.ruoyi.disasterassessment.service.IMiningFaceModelService;

/**
 * 基础建模-采面建模Service业务层处理
 * 
 * @author hcc
 * @date 2023-12-20
 */
@Service
public class MiningFaceModelServiceImpl implements IMiningFaceModelService 
{
    @Autowired
    private MiningFaceModelMapper miningFaceModelMapper;
    @Autowired
    private DisasterEvaluatingReportMapper disasterEvaluatingReportMapper;
    /**
     * 查询基础建模-采面建模
     * 
     * @param id 基础建模-采面建模主键
     * @return 基础建模-采面建模
     */
    @Override
    public MiningFaceModel selectMiningFaceModelById(Long id)
    {
        return miningFaceModelMapper.selectMiningFaceModelById(id);
    }

    /**
     * 查询基础建模-采面建模列表
     * 
     * @param miningFaceModel 基础建模-采面建模
     * @return 基础建模-采面建模
     */
    @Override
    public List<MiningFaceModel> selectMiningFaceModelList(MiningFaceModel miningFaceModel)
    {
        return miningFaceModelMapper.selectMiningFaceModelList(miningFaceModel);
    }

    /**
     * 新增基础建模-采面建模
     * 
     * @param miningFaceModel 基础建模-采面建模
     * @return 结果
     */
    @Override
    public int insertMiningFaceModel(MiningFaceModel miningFaceModel)
    {
        return miningFaceModelMapper.insertMiningFaceModel(miningFaceModel);
    }

    /**
     * 修改基础建模-采面建模
     * 
     * @param miningFaceModel 基础建模-采面建模
     * @return 结果
     */
    @Override
    public int updateMiningFaceModel(MiningFaceModel miningFaceModel)
    {
        return miningFaceModelMapper.updateMiningFaceModel(miningFaceModel);
    }

    /**
     * 批量删除基础建模-采面建模
     * 
     * @param ids 需要删除的基础建模-采面建模主键
     * @return 结果
     */
    @Override
    public int deleteMiningFaceModelByIds(Long[] ids)
    {
        return miningFaceModelMapper.deleteMiningFaceModelByIds(ids);
    }

    /**
     * 删除基础建模-采面建模信息
     * 
     * @param id 基础建模-采面建模主键
     * @return 结果
     */
    @Override
    public int deleteMiningFaceModelById(Long id)
    {
        return miningFaceModelMapper.deleteMiningFaceModelById(id);
    }

    @Override
    public List<MiningFaceDto> getAreaList() {
        List<MiningFaceModel> miningFaceModels = miningFaceModelMapper.getAreaList();
        List<MiningFaceDto> list = miningFaceModels.stream().map(miningFaceModel -> {
            MiningFaceDto miningFaceDto = new MiningFaceDto();
            BeanUtils.copyProperties(miningFaceModel, miningFaceDto);
            return miningFaceDto;
        }).collect(Collectors.toList());
        return list;
    }
}
